package cn.edu.scau.cmi.zhangweiming.adapter;
import java.util.ArrayList;
import java.util.List;
//import java.awt.Button;
//import java.awt.List;
//import java.awt.TextArea;
//import java.awt.TextField;
import java.util.ArrayList;

import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.text.Text;
import javafx.scene.control.Button;
import javafx.scene.control.TextArea;
import javafx.scene.control.TextField;

import cn.edu.scau.cmi.zhangweiming.adapter.Student;



public class SortUtil_controller {
	List<Student> list=new ArrayList<Student>();
	SortUtilOfClass classadapter=new SortUtilOfClass();
	SortUtilOfObject objectadapter=new SortUtilOfObject();
	SortUtil sort=new SortUtil();
	SortUtilOfObject sort2=new SortUtilOfObject();
	
	@FXML
	   private Button insert;
	@FXML
	   private Text Name,ID;
	@FXML
	   private TextField nameText,idText;
	@FXML
	   private TextArea output1,output2;
	
	public void result(ActionEvent event) {
		output1.setText(classadapter.say()+"\n");
		output2.setText(objectadapter.say()+"\n");
		Student student=new Student(nameText.getText(),idText.getText()); 
		list.add(student);
		sort.sortStudent(list);
		for(int i=0;i<list.size();i++) {
			output1.appendText(list.get(i).getname()+"	"+list.get(i).getid());		
			output1.appendText("\n");
		}
		sort2.sortStudent(list);
		for(int i=0;i<list.size();i++) {
			output2.appendText(list.get(i).getname()+"	"+list.get(i).getid());		
			output2.appendText("\n");
		}
	}
}
